<template>
  <div>
    <el-dialog
      title="商品类目 -- 规格参数选择"
      :visible.sync="dialogVisible"
      width="60%"
      :before-close="handleClose"
    >
      <!-- 商品类目  Commodity - PromptTree -->
      <PromptTree @changeTree="changeTree" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addHandle" :disabled="flag">
          确定并添加分组
        </el-button>
      </span>
      <!-- 内弹框 商品规格参数 -->
    </el-dialog>
    <SpecIncuding ref="inDialog" />
  </div>
</template>

<script>
import PromptTree from "../Commodity/PromptTree";
import SpecIncuding from "./SpecIncuding";
import { mapMutations } from "vuex";
export default {
  components: { PromptTree, SpecIncuding },
  data() {
    return {
      dialogVisible: false,
      flag: true,
    };
  },
  methods: {
    ...mapMutations("specModule", ["setTitle"]),
    // 关闭弹窗
    handleClose(done) {
      done();6
    },
    // changeTree -- 改变弹窗确认按钮状态
    changeTree(val) {
      this.flag = false;
      this.$refs.inDialog.treeData = val;
    },
    addHandle() {
      this.$refs.inDialog.innerVisible = true;
      this.setTitle("添加规格");
    },
  },
};
</script>

<style lang="less" scoped>
</style>